﻿using NUnit.Framework;
using ScrappyDB.Utilities;

namespace ScrappyDB.UnitTests
{
    
    
    /// <summary>
    ///This is a test class for LatLonMathTest and is intended
    ///to contain all LatLonMathTest Unit Tests
    ///</summary>
    [TestFixture()]
    public class LatLonMathTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        /// <summary>
        ///A test for CalculateDistance
        ///</summary>
        [Test()]
        public void calcDistanceLatLonsTest()
        {
            double lat0 = 45F; 
            double lon0 = -90F; 
            double lat = 46F; 
            double lon = -90F;

            int expected = 69; //one degree of latitude at 45 ~= 69 miles
            double actual = LatLonMath.CalculateDistance(lat0, lon0, lat, lon, false);
            Assert.AreEqual(expected, (int)actual);

            int expected2 = 111; //one degree of latitude at 45 ~= 111 kilometers
            double actual2 = LatLonMath.CalculateDistance(lat0, lon0, lat, lon, true);
            Assert.AreEqual(expected2, (int)actual2);
        }


    }
}
